import request from "@/utils/request";

/**
 * 3.创建或者更新预算报价模板（基础信息维护）
 * @param { basicSave } data
 */
export const basicSave = data => {
  return request({
    url: "/quote/budget/template/basic/save",
    method: "post",
    data
  });
};
/**
 * 3.1.预算报价模板列表
 * @param { getBudgetQuotationList }
 */
export const getBudgetQuotationList = () => {
  return request({
    url: "/quote/budget/template/list",
    method: "post"
  });
};
/**
 * 3.1.5.删除预算报价模板
 * @param { getBudDelete }data
 */
export const getBudDelete = data => {
  return request({
    url: "/quote/budget/template/delete",
    method: "post",
    data
  });
};
/**
 * 3.1.5.4.复制预算报价模板
 * @param { getBudDelete }data
 */
export const templateCopy = data => {
  return request({
    url: "/quote/budget/template/copy",
    method: "post",
    data
  });
};
// 空间--------------------------------------------------------------------------
/**
 * 3.1.5.4.1.创建或者保存空间
 * @param { getBudDelete }data
 */
export const spaceSave = data => {
  return request({
    url: "/quote/budget/space/save",
    method: "post",
    data
  });
};
/**
 * 3.1.5.4.1.5.获取空间列表(用于综合项页面显示)
 * @param { getSpaceList }data
 */
export const getSpaceList = templateId => {
  return request({
    url: `/quote/budget/space/list?templateId=${templateId}`,
    method: "get"
  });
};
/**
 * 3复制空间
 * @param { spaceCopy }data
 */
export const spaceCopy = data => {
  return request({
    url: "/quote/budget/space/copy",
    method: "post",
    data
  });
};
/**
 * 4.删除空间
 * @param { spaceDelete }data
 */
export const spaceDelete = data => {
  return request({
    url: "/quote/budget/space/delete",
    method: "post",
    data
  });
};
/**
 * 4.2.预算报价模板详情（包含空间列表及综合项）
 * @param { templateDetail }data
 */
export const templateDetail = templateId => {
  return request({
    url: `/quote/budget/template/detail?templateId=${templateId}`,
    method: "get"
  });
};
/**
 * 4.2.8.删除定额项
 * @param { templateDetail }data
 */
export const deleteSpaceItem = data => {
  return request({
    url: "/quote/budget/space/deleteSpaceItem",
    method: "post",
    data
  });
};
/**
 * 42.创建或者更新综合项
 * @param { comprehensiveSave }data
 */
export const comprehensiveSave = data => {
  return request({
    url: "/quote/budget/comprehensive/save",
    method: "post",
    data
  });
};
/**
 * 42.6.模板详情保存
 * @param { detailSave }data
 */
export const detailSave = data => {
  return request({
    url: "/quote/budget/template/detail/save",
    method: "post",
    data
  });
};
/**
 * 42.6.3.删除综合项
 * @param { comprehensiveDelete }data
 */
export const comprehensiveDelete = data => {
  return request({
    url: "/quote/budget/comprehensive/delete",
    method: "post",
    data
  });
};
/**
 * 42.6.3.定额模版商品条件获取
 * @param { quotaProductList }data
 */
export const quotaProductList = (quotaId, productType) => {
  return request({
    url: `/quote/quotaProduct/quotaProductList/${quotaId}?productType=${productType}`,
    method: "get"
  });
};
/**
 * 42.6.3.定额模版组合条件获取
 * @param { quotaProductConditionList }data
 */
export const quotaProductConditionList = (quotaId, productType) => {
  return request({
    url: `/quote/quotaProductCondition/quotaProductConditionList/${quotaId}?productType=${productType}`,
    method: "get"
  });
};
/**
 * 6.导入定额
 * @param { importQuota }data
 */
export const importQuota = data => {
  return request({
    url: "/quote/budget/space/importQuota",
    method: "post",
    data
  });
};
/**
 * 6.7.导入材料
 * @param { importMaterials }data
 */
export const importMaterials = data => {
  return request({
    url: "/quote/budget/space/importMaterials",
    method: "post",
    data
  });
};
/**
 * 6.7.3.保存临时商品
 * @param { saveTempProduct }data
 */
export const saveTempProduct = data => {
  return request({
    url: "/quote/budget/fixedPrice/saveTempProduct",
    method: "post",
    data
  });
};
/**
 * 6.7.3.5.获取临时保存的商品
 * @param { getTempProductList }code
 */
export const getTempProductList = code => {
  return request({
    url: `/quote/budget/fixedPrice/getTempProductList?code=${code}`,
    method: "get"
  });
};
/**
 * 6.7.3.5.获取临时保存的商品
 * @param { delTempProduct }data
 */
export const delTempProduct = data => {
  return request({
    url: "/quote/budget/fixedPrice/delTempProduct",
    method: "post",
    data
  });
};
/**
 * 6.7.3.5.2.设置固定售价商品列表（分页）
 * @param { pageList }data
 */
export const pageList = data => {
  return request({
    url: "/quote/budget/fixedPrice/pageList",
    method: "post",
    data
  });
};
/**
 * 6.保存选中的商品列表
 * @param { fixedPriceSave }data
 */
export const fixedPriceSave = data => {
  return request({
    url: "/quote/budget/fixedPrice/save",
    method: "post",
    data
  });
};
/**
 * 6.7.删除选中的商品信息
 * @param { fixedPriceDelete }data
 */
export const fixedPriceDelete = data => {
  return request({
    url: "/quote/budget/fixedPrice/delete",
    method: "post",
    data
  });
};
/**
 * 6.7.1.不可选择定额模板列表
 * @param { noPoplist }templateId
 */
export const noPoplist = templateId => {
  return request({
    url: `/quote/budget/noPop/list?templateId=${templateId}`,
    method: "get"
  });
};
/**
 * 6.7.1.3.删除设置定额模板
 * @param { noPopDelete }templateId
 */
export const noPopDelete = data => {
  return request({
    url: "/quote/budget/noPop/delete",
    method: "post",
    data
  });
};
/**
 * 2.保存设置定额模板
 * @param { noPopSave }data
 */
export const noPopSave = data => {
  return request({
    url: "/quote/budget/noPop/save",
    method: "post",
    data
  });
};

/**
 * 查询工程量核量配置
 * @param { getQuantityConfig }data
 */
export const getQuantityConfig = () => {
  return request({
    url: "/quote/config/list",
    method: "get"
  });
};

/**
 * 查询工程量核量配置
 * @param { updateQuantityConfig }data
 */
export const updateQuantityConfig = data => {
  return request({
    url: "/quote/config/save",
    method: "post",
    data
  });
};
/**
 * 修改模板排序
 */

export const batchSort = data => {
  return request({
    url: "/quote/budget/template/batchSort",
    method: "post",
    data
  });
};

export const setTemplateTime = data => {
  return request({
    url: "/quote/budget/template/setTimes",
    method: "post",
    data
  });
};

export const getContractTypeList = () => {
  return request({
    url: "/quote/budget/template/contractTypeList",
    method: "get"
  });
};

export const updateTemplateStatus = data => {
  return request({
    url: "/quote/budget/template/setStatus",
    method: "post",
    data
  });
};

/**
 * 查询工程量核量
 * @param { getQuantityList }data
 */
export const getQuantityList = data => {
  return request({
    url: "/quote/contract/nuclear/budget/getCustomerList",
    method: "post",
    data
  });
};

/**
 * 查询工程量核量详情
 * @param { getQuantityDetail }data
 */
export const getQuantityDetail = contractId => {
  return request({
    url: `/quote/contract/nuclear/budget/getDetail/${contractId}`,
    method: "get"
  });
};

export const packageAddQuota = data => {
  return request({
    url: "/quote/contract/nuclear/budget/packageAddQuota",
    method: "post",
    data
  });
};

export const packageAddMaterial = data => {
  return request({
    url: "/quote/contract/nuclear/budget/packageAddMaterial",
    method: "post",
    data
  });
};

export const inventoryAddQuota = data => {
  return request({
    url: "/quote/contract/nuclear/budget/inventoryAddQuota",
    method: "post",
    data
  });
};

export const inventoryAddMaterial = data => {
  return request({
    url: "/quote/contract/nuclear/budget/inventoryAddMaterial",
    method: "post",
    data
  });
};

export const updateActualUsedNum = data => {
  return request({
    url: "/quote/contract/nuclear/budget/updateActualUsedNum",
    method: "post",
    data
  });
};

export const updateProjectVal = data => {
  return request({
    url: "/quote/contract/nuclear/budget/updateProjectVal",
    method: "post",
    data
  });
};

export const deleteQuota = data => {
  return request({
    url: "/quote/contract/nuclear/budget/deleteQuota",
    method: "post",
    data
  });
};
export const deleteProduct = data => {
  return request({
    url: "/quote/contract/nuclear/budget/deleteProduct",
    method: "post",
    data
  });
};

export const budgetCommit = data => {
  return request({
    url: "/quote/contract/nuclear/budget/commit",
    method: "post",
    data
  });
};

/**
 * V0.7套餐明细商品条件获取
 * @param { detailsProductList }data
 */
export const detailsProductList = (templateId, spaceId) => {
  return request({
    url: `/quote/budget/ysPackageCombine/detailsProductList?templateId=${templateId}&&spaceId=${spaceId}`,
    method: "get"
  });
};
/**
 * V0.7套餐明细组合条件获取
 * @param { detailsConditionList }data
 */
export const detailsConditionList = (templateId, spaceId) => {
  return request({
    url: `/quote/budget/ysPackageCombine/detailsConditionList?templateId=${templateId}&&spaceId=${spaceId}`,
    method: "get"
  });
};
//V0.7新增套餐
export const createPackCombine = data => {
  return request({
    url: "/quote/budget/ysPackageCombine/createPackCombine",
    method: "put",
    data
  });
};
//查询套餐列表
export const getPackageCombinelist = (current, size, bunStyle, status, bundName) => {
  return request({
    url: `/quote/budget/ysPackageCombine/page?current=${current}&size=${size}&bunStyle=${bunStyle}&status=${status}&bundName=${bundName}`,
    method: "get"
  });
};
//删除套餐列表
export const delectPackCombine = data => {
  return request({
    url: "/quote/budget/ysPackageCombine/batchDel",
    method: "delete",
    data
  });
};
//修改套餐
export const updatePackageCombine = data => {
  return request({
    url: "/quote/budget/ysPackageCombine/modifyPackCombine",
    method: "post",
    data
  });
};
//启用状态
export const enablePackCombine = data => {
  return request({
    url: "/quote/budget/ysPackageCombine/enablePackCombine",
    method: "post",
    data
  });
};

//禁用状态
export const disablePackCombinee = data => {
  return request({
    url: "/quote/budget/ysPackageCombine/disablePackCombine",
    method: "post",
    data
  });
};
//隐藏所有商品销售价
export const hidePrice = () => {
  return request({
    url: "/quote/budget/ysPackageCombine/hidePrice",
    method: "post"
  });
};

//显示所有商品销售价
export const showPrice = () => {
  return request({
    url: "/quote/budget/ysPackageCombine/showPrice",
    method: "post"
  });
};

//获取活动模板列表
export const getActivityTemplateList = templateName => {
  return request({
    url: `/quote/budget/ysPackageCombine/getActivityTemplateList?templateName=${templateName}`,
    method: "get"
  });
};

//变更单工程核量记录（快照）
export const getExchangeNuclearSnapshot = props => {
  return request({
    url: `/quote/contract/nuclear/budget/getExchangeNuclearSnapshot/${props.nuclearId}`,
    method: "get"
  });
};
//判断是否为纯采购
export const tenantParams = () => {
  return request({
    url: "/quote/budget/template/tenantParams",
    method: "post"
  });
};
